package za.ac.nmmu.muhelp.model;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Version;
import javax.persistence.ManyToOne;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;

import org.hibernate.validator.constraints.Length;

/**
 * Entity implementation class for Entity: XMPPConfiguration
 * 
 */
@Entity
public class XMPPConfiguration implements Serializable {


	@Id
	@GeneratedValue
	@Column(name = "id", unique = true)
	private Long id;

	@Version
	private Long version;

	private Boolean live;

	@Length(max = 256)
	private String name;

	@Length(max=256)
	private String description;

	@Length(max=256)
	private String host;

	@Length(max=256)
	private String username;

	@Length(max=256)
	private String password;

	private Integer port;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "role_id", referencedColumnName="id")
	private Role role;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "service_id", referencedColumnName="id")
	private Service service;

	public XMPPConfiguration() {
		super();
		initialize();
	}
	
	void initialize() {
		live = Boolean.TRUE;
		name=new String();
		description = new String();
		username = new String();
		password = new String();
		host = new String();
		port = 5222;
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	public Boolean getLive() {
		return this.live;
	}

	public void setLive(Boolean live) {
		this.live = live;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getHost() {
		return this.host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getPort() {
		return this.port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public Service getService() {
		return service;
	}
	
	public void setService(Service service) {
		this.service = service;
	}

}
